package com.base.jdk8;

/**
 * Java8 的线程编写方式
 *
 * @author: May
 * @date 2020/9/7
 */
public class HelloFunctionalInterFace {
    public static void main(String[] args) {
        Thread demoTask = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName());
            }
        });
        demoTask.setName("demoTask");
        demoTask.start();

        // java 8开启一个线程
        Thread java8Task = new Thread(() -> System.out.println(Thread.currentThread().getName()));
        java8Task.setName("java8Task");
        java8Task.start();

    }
}
